#!/bin/bash
# 在CentOS中安装mysql主库的脚本
# 可以直接执行

yum install -y mariadb mariadb-server

echo '[mysqld]
log-bin=mysql-bin #开启二进制日志
server-id=1 #设置server-id' > /etc/my.cnf.d/master.cnf

systemctl start mariadb

mysqladmin --user=root --password= password qjx36uGC

mysql --user=root --password=qjx36uGC -e "CREATE USER 'slave'@'%' IDENTIFIED BY 'AnfONgWS';GRANT REPLICATION SLAVE ON *.* TO 'slave'@'%';flush privileges;SHOW MASTER STATUS;"

